#!/usr/bin/env bash

# Make the config dir
mkdir -p /tmp/config


# Symplink the custom_components dir
if [ -d "/tmp/config/custom_components" ]; then
  rm -rf /tmp/config/custom_components
fi
ln -sf "${PWD}/custom_components" /tmp/config/custom_components

# Symlink configuration.yaml
if [ ! -f ".devcontainer/configuration.yaml" ]; then
  cp .devcontainer/sample_configuration.yaml .devcontainer/configuration.yaml
fi
ln -sf "${PWD}/.devcontainer/configuration.yaml" /tmp/config/configuration.yaml


# Start Home Assistant
hass -c /tmp/config